package com.mycontact.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.place.shared.PlaceController;
import com.mycontact.client.ui.EditContactMainPanel;
import com.mycontact.client.ui.ViewContactMainPanel;
import com.mycontact.shared.MycontactRequestFactory;

public class ClientFactoryImpl implements ClientFactory {
	private static final EventBus eventBus = new SimpleEventBus();
	private static final PlaceController placeController = new PlaceController(eventBus);
	private static final MycontactRequestFactory requestFactory = GWT.create(MycontactRequestFactory.class);
	private static final ViewContactMainPanel viewContactMainPanel = new ViewContactMainPanel();
	private static final EditContactMainPanel editContactMainPanel = new EditContactMainPanel();
	private static String SelectedContactId = "";

	@Override
	public EventBus getEventBus() {
		return eventBus;
	}

	@Override
	public PlaceController getPlaceController() {
		return placeController;
	}

	@Override
	public MycontactRequestFactory getRequestFactory() {
		return requestFactory;
	}

	@Override
	public ViewContactMainPanel getViewContactMainPanel() {
		return viewContactMainPanel;
	}

	@Override
	public EditContactMainPanel getEditContactMainPanel() {
		return editContactMainPanel;
	}

	@Override
	public void setSelectedContactId(String contactId) {
		SelectedContactId = contactId;
	}

	@Override
	public String getSelectedContactId() {
		return SelectedContactId;
	}

	@Override
	public void initializeRequestFactory() {
		requestFactory.initialize(eventBus);
	}
}
